package day_2022_7_to_8.day48;

/**
 * @author haomin
 * @date 2022/08/01 11:18
 **/
public class Day17_2_Num1374_GenerateTheString {
    // 奇数就全部a, 偶数就是 n-1个a + 一个b
    class Solution {
        public String generateTheString(int n) {
            String res = "";
            if(n % 2 != 0){
                for (int i = 0; i < n; i++) res+='a';
            }else {
                for (int i = 0; i < n-1; i++) res+='a';
                res+='b';
            }
            return res;
        }
    }

    // 简化
    class Solution2 {
        public String generateTheString(int n) {
            String res = "";
            for (int i = 0; i < n-1; i++) res+='a';
            return n % 2 != 0 ? res+'a' : res+'b';
        }
    }
}
